import { defineStore } from 'pinia'
import store from '../pinia-store'
import api from '@/api'

export const useUserStore = defineStore(
    // 唯一ID
    'userId',
    {
        state: () => ({
     
            workerPositionList: [],// 工作岗位
        }),
        getters: {
            getWorkePosition() {
                return new Promise(resolve => {
                    api.user.accountWork().then(res => {
                        res.forEach(item => {
                            item['label'] = item['name']
                            item['sourceType'] = 'work'
                            item['isSelect'] = false

                        });
                        this.workerPositionList = res
                        console.log(this)
                    })

                })

            }
        },
        actions: {
          
        
        }
    }
)
export const useUserOutsideStore = () => {
    return useUserStore(store.piniaStore)
}
